<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@include file="common/header.jsp"%>
<div class="clearfix"></div>
<div class="row">
  <div class="col-md-12 col-sm-12 col-xs-12">
    <div class="x_panel">
      <div class="x_title">
        <h2>新增手游基础信息 <i class="fa fa-user"></i><small>${devUserSession.devName}</small></h2>
             <div class="clearfix"></div>
      </div>
      <div class="x_content">
           <div class="clearfix"></div>
        <form class="form-horizontal form-label-left" action="appinfoaddsave" method="post" enctype="multipart/form-data">
          <div class="item form-group">
            <label class="control-label col-md-3 col-sm-3 col-xs-12">软件名称 <span class="required">*</span>
            </label>
            <div class="col-md-6 col-sm-6 col-xs-12">
              <input id="softwareName" class="form-control col-md-7 col-xs-12" 
               data-validate-length-range="20" data-validate-words="1" name="softwareName"  required="required"
               placeholder="请输入软件名称" type="text">
            </div>
          </div>
          <div class="item form-group">
            <label class="control-label col-md-3 col-sm-3 col-xs-12" for="name">APK名称 <span class="required">*</span>
            </label>
            <div class="col-md-6 col-sm-6 col-xs-12">
              <input id="APKName" class="form-control col-md-7 col-xs-12" 
              	data-validate-length-range="20" data-validate-words="1" name="APKName"   required="required"
              	placeholder="请输入APK名称" type="text">
            </div>
          </div>
          
          <div class="item form-group">
            <label class="control-label col-md-3 col-sm-3 col-xs-12" for="name">支持ROM <span class="required">*</span>
            </label>
            <div class="col-md-6 col-sm-6 col-xs-12">
              <input id="supportROM" class="form-control col-md-7 col-xs-12" name="supportROM" 
              	data-validate-length-range="20" data-validate-words="1"   required="required"
              	placeholder="请输入支持的ROM" type="text">
            </div>
          </div>
          <div class="item form-group">
            <label class="control-label col-md-3 col-sm-3 col-xs-12" for="name">界面语言 <span class="required">*</span>
            </label>
            <div class="col-md-6 col-sm-6 col-xs-12">
              <input id="interfaceLanguage" class="form-control col-md-7 col-xs-12" 
              data-validate-length-range="20" data-validate-words="1" name="interfaceLanguage"   required="required"
              placeholder="请输入软件支持的界面语言" type="text">
            </div>
          </div>
          <div class="item form-group">
            <label class="control-label col-md-3 col-sm-3 col-xs-12" for="number">软件大小 <span class="required">*</span>
            </label>
            <div class="col-md-6 col-sm-6 col-xs-12">
              <input type="number" id="softwareSize" name="softwareSize"   required="required" onkeyup="value=value.replace(/[^\d]/g,'')"
              data-validate-minmax="10,500"  placeholder="请输入软件大小，单位为Mb" class="form-control col-md-7 col-xs-12">
            </div>
          </div>
          
          <div class="item form-group">
            <label class="control-label col-md-3 col-sm-3 col-xs-12" for="number">下载次数 <span class="required">*</span>
            </label>
            <div class="col-md-6 col-sm-6 col-xs-12">
              <input type="number" id="downloads" name="downloads"   required="required"
              data-validate-minmax="10,500"  placeholder="请输入下载次数" class="form-control col-md-7 col-xs-12">
            </div>
          </div>
          <div class="item form-group">
            <label class="control-label col-md-3 col-sm-3 col-xs-12">所属平台 <span class="required">*</span></label>
            <div class="col-md-6 col-sm-6 col-xs-12">
              <select name="flatformId" id="flatformId" class="form-control"   required="required">
                <option value="Steam">Steam</option>
                <option value="暴雪战网">暴雪战网</option>
                <option value="Ubisoft">Ubisoft</option>
                <option value="QQ游戏平台">QQ游戏平台</option>
              </select>
            </div>
          </div>
          
          <div class="item form-group">
            <label class="control-label col-md-3 col-sm-3 col-xs-12">一级分类 <span class="required">*</span></label>
            <div class="col-md-6 col-sm-6 col-xs-12">
              <select name="categoryLevel1" id="categoryLevel1" class="form-control"   required="required">
                <option value="动作">动作</option>
                <option value="冒险">冒险</option>
                <option value="模拟">模拟</option>
                <option value="角色扮演">角色扮演</option>
                <option value="休闲">休闲</option>
                <option value="其他">其他</option>
              </select>
            </div>
          </div>
          
          <div class="item form-group">
            <label class="control-label col-md-3 col-sm-3 col-xs-12">二级分类 <span class="required">*</span></label>
            <div class="col-md-6 col-sm-6 col-xs-12">
              <select name="categoryLevel2" id="categoryLevel2" class="form-control"  required="required">
                <option value="单机">单机</option>
                <option value="网游">网游</option>
                <option value="联机">联机</option>
              </select>
            </div>
          </div>
          
          <div class="item form-group">
            <label class="control-label col-md-3 col-sm-3 col-xs-12">三级分类 <span class="required">*</span></label>
            <div class="col-md-6 col-sm-6 col-xs-12">
              <select name="categoryLevel3" id="categoryLevel3" class="form-control"  required="required">
                <option value="街机游戏">街机游戏</option>
                <option value="主机游戏">主机游戏</option>
                <option value="电脑游戏">电脑游戏</option>
                <option value="便携游戏">便携游戏</option>
              </select>
            </div>
          </div>
          <div class="item form-group">
            <label class="control-label col-md-3 col-sm-3 col-xs-12">手游状态 <span class="required">*</span>
            </label>
            <div class="col-md-6 col-sm-6 col-xs-12">
            	<input type="hidden" name="status" id="status" value="1">待审核
            </div>
          </div>
          <div class="item form-group">
            <label class="control-label col-md-3 col-sm-3 col-xs-12">应用简介 <span class="required">*</span>
            </label>
            <div class="col-md-6 col-sm-6 col-xs-12">
              <textarea id="appInfo" name="appInfo"     required="required"
              placeholder="请输入本软件的相关信息，本信息作为软件的详细信息进行软件的介绍。" class="form-control col-md-7 col-xs-12"></textarea>
            </div>
          </div>
           <div class="item form-group">
            <label class="control-label col-md-3 col-sm-3 col-xs-12">LOGO图片 <span class="required">*</span></label>
            <div class="col-md-6 col-sm-6 col-xs-12">
            <input type="file" class="form-control col-md-7 col-xs-12" name="logoPicPath"  required="required" id="logoPicPath"/>
            </div>
          </div>
          <div class="ln_solid"></div>
          <div class="form-group">
            <div class="col-md-6 col-md-offset-3">
              <button id="send" onclick=add() type="button" class="btn btn-success">保存</button>
              <button type="button" class="btn btn-primary" id="back">返回</button>
              <br/><br/>
            </div>
          </div>
        </form>
      </div>
    </div>
  </div>
</div>
<%@include file="common/footer.jsp"%>
<script src="${pageContext.request.contextPath }/statics/localjs/appinfoadd.js"></script>
<script src="http://libs.baidu.com/jquery/2.1.4/jquery.min.js"></script>
<script type="text/javascript">
    function add() {
      var softwareName = $("#softwareName").val();
      var apkName = $("#APKName").val();
      var supportRom = $("#supportROM").val();
      var interfaceLanguage = $("#interfaceLanguage").val();
      var flatform = $('#flatformId option:selected').val();
      var flatformId = null;
      if(flatform=="动作"){
        flatformId=0
      }else{
        flatformId=1
      }
      var categoryLevel1 =$('#categoryLevel1 option:selected').val();
      var categoryLeve11 = null;
      if(categoryLevel1=="动作"){
        categoryLeve11=0
      }else{
        categoryLeve11=1
      }
      var categoryLevel2 = $('#categoryLevel2 option:selected').val();
      var categoryLeve12 = null;
      if(categoryLevel2=="单机"){
        categoryLeve12=0
      }else{
        categoryLeve12=1
      }
      var categoryLevel3 = $('#categoryLevel3 option:selected').val();
      var categoryLeve13 = null;
      if(categoryLevel3=="街机游戏"){
        categoryLeve13=0
      }else{
        categoryLeve13=1
      }
      var softwareSize = $("#softwareSize").val();
      var downloads = 0;
      var appInfo = $("#appInfo").val();
      var formData = new FormData();
      formData.append("logoPicPath", document.getElementById("logoPicPath").files[0]);
      $.ajax({
        "url":"/XiangMu_war_exploded/insertAi",
        "type":"get",
        "data":{
          "softwareName":softwareName,
          "apkName":apkName,
          "supportRom":supportRom,
          "interfaceLanguage":interfaceLanguage,
          "flatformId":flatformId,
          "categoryLeve11":categoryLeve11,
          "categoryLeve12":categoryLeve12,
          "categoryLeve13":categoryLeve13,
          "softwareSize":softwareSize,
          "downloads":downloads,
          "appInfo":appInfo
        },
        "dataType":"text",
        "success":function(result){
          if(result=="true"){
            alert("添加成功");
            window.location.reload();
          }else{
            alert("添加失败");
          }
        },
        "error":function(){
          alert("服务器错误");
        }
      });
    }
</script>